package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstUserClientViewDao;
import com.financing.wap.dto.DstUserClientViewDTO;
import com.financing.wap.service.IDstUserClientViewService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_user_client_view  
 * 用户客户表 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstUserClientViewService")
public class DstUserClientViewServiceImpl implements IDstUserClientViewService{

	@Autowired
	private IDstUserClientViewDao dstUserClientViewDao;

	@Override
	public int insert(DstUserClientViewDTO dstUserClientView) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstUserClientView);
		DTOdateSetUtil.setUpdateInfo(dstUserClientView);
		dstUserClientView.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstUserClientViewDao.insert(dstUserClientView);
	}

	@Override
	public void update(DstUserClientViewDTO dstUserClientView) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserClientView);
		dstUserClientViewDao.update(dstUserClientView);
	}

	@Override
	public void updateForce(DstUserClientViewDTO dstUserClientView) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstUserClientView);
		dstUserClientViewDao.updateForce(dstUserClientView);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstUserClientViewDao.delete(id);
	}
	
	@Override
	public List<DstUserClientViewDTO> queryList(DstUserClientViewDTO dstUserClientView) throws SQLException {
		return dstUserClientViewDao.queryList(dstUserClientView);
	}

	@Override
	public int queryListCount(DstUserClientViewDTO dstUserClientView) throws SQLException {
		return dstUserClientViewDao.queryListCount(dstUserClientView);
	}

	@Override
	public DstUserClientViewDTO loadById(Integer id) throws SQLException {
		return dstUserClientViewDao.loadById(id);
	}
 	@Override
	public DstUserClientViewDTO queryListGetFirst(DstUserClientViewDTO dstUserClientView)
			throws SQLException {
		 List<DstUserClientViewDTO> queryList = queryList(dstUserClientView);
		 if(queryList==null||queryList.size()==0){
			 return new DstUserClientViewDTO();
		 }
		 return queryList.get(0);
	}
}
